home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / c-runtime / tests / SubClass3.m < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.1 KB  |  87 lines

  1. /* -*-objc-*- */
  2.  
  3. /* 
  4.   $Header$
  5.   $Author: dglattin $
  6.   $Date$
  7.   $Log$
  8.  */
  9.  
  10. #include  <assert.h>
  11. #include  <limits.h>
  12. #include  <stdlib.h>
  13. #include  <strings.h>
  14. #include  <SubClass3.h>
  15.  
  16.  
  17. @implementation SubClass3
  18.  
  19. #define THE_MESSAGE "This is a test message from"
  20.  
  21.  
  22. + initialize {
  23.  
  24.   printf( "If you see this message then SubClass3 received a"
  25.     " +initialize method\n" );
  26.   
  27.   return self;
  28. }
  29.  
  30.  
  31. + new {
  32.  
  33.   self = [ super new ];
  34.   sprintf (smart, THE_MESSAGE);
  35.  
  36.   return self;
  37. }
  38.  
  39.  
  40. - print:( const char* )aPhrase {
  41.  
  42.   char  aMsg[ 2048 ];
  43.   
  44.   
  45.   sprintf( aMsg, "This message comes to you from SubClass3 forwarded"
  46.     " to it's super class, msg=%s\n", aPhrase );
  47.   
  48.   return [ super print:aMsg ] ;
  49. }
  50.  
  51.  
  52. - ( int )additionalMethod {
  53.  
  54.  
  55.   return INT_MAX;
  56. }
  57.  
  58.  
  59. - storeOn:( int )aFd {
  60.  
  61.   int len;
  62.   
  63.   
  64.   [ super storeOn:aFd ];
  65.   len = write (aFd, smart, sizeof (smart));
  66.   assert(len == sizeof (smart));
  67.   
  68.   return self;
  69. }
  70.  
  71.  
  72. - readFrom:( int )aFd {
  73.  
  74.   int len;
  75.   
  76.   
  77.   [ super readFrom:aFd ];
  78.   len = read (aFd, smart, sizeof (smart));
  79.   assert(len == sizeof (smart));
  80.   assert(!strcmp (smart, THE_MESSAGE));
  81.   
  82.   return self;
  83. }
  84.  
  85.  
  86.  
  87. @end